package main

import (
	"fmt"
	"regexp"
)

func main() {

	buf := "abc azc a7c aac 888 a9c  tac"

	// reg := regexp.MustCompile(`a.c`) //a与c之间有数的所有组合
	// ==> [[abc] [azc] [a7c] [aac] [a9c]]
	reg := regexp.MustCompile(`a[0-9]c`) // a与c之间是数字
	// ==> [[a7c] [a9c]]
	// reg := regexp.MustCompile(`a\dc`)
	//
	if reg == nil {
		fmt.Println("regexp err")
		return
	}

	result := reg.FindAllStringSubmatch(buf, -1)
	fmt.Println("result = ", result)

}
